package org.personae.web;


import java.util.Map;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/")
public class ValidationController {

        // Display the form on the get request
        @RequestMapping(method = RequestMethod.GET)
        public String showValidatinForm(Map model) {
                V v = new V();
                model.put("v", v);
                return "v";
        }

        // Process the form.
        @RequestMapping(method = RequestMethod.POST)
        public String processValidatinForm( Map model,@Valid V v,BindingResult result) {
                if (result.hasErrors()) {
                
                
                        return "v";
                }
                // Add the saved validationForm to the model
             //   model.put("v", validationForm);
                return "suc";
        }

}